package inabit.inabitcompiler.productions.variable;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**L' -> ,L*/
/**@author Rafael Rocha*/
public class L1_Rule extends Production{
	private NonTerminal L;
	
	public L1_Rule(){
		super("L'");
	}

	@Override
	protected Symbol[] production(final NonTerminal nonTerminal) {
		L = new NonTerminal("L");
		
		Symbol[] symbols = {
				new Terminal(InabitTokenClass.COMMA),
				L,
				new InabitSemanticAction(nonTerminal) {
					
					@Override
					public void execute() throws Exception {
						nonTerminal.code = ","+ L.code;
					}
				}
		};
		return symbols;
	}
}
